Its a tough question to answer because it depends on so many factors and is situational.
Everyone has a hollywood- style, preconceived idea of what they would do given ideal circumstances.
Most self-defence instructors will tell you to give them what they want, if they are after money and hope they go away. If they dont go away, then you need a plan B, which may involve fighting back, maybe fighting for your life, using obstacles or running way, trying to get your hands on an improvised weapon or shield, or a firearm. Then, you need to know a little bit about using that weapon effectively and in a way that the attacker cant take it off you.
I think self- defence should be taught at schools and is a life skill everyone should have, like defensive driving.